# -*- coding: utf-8 -*-
# @Author  : pony.guan
# @Time    : 17:28
# Description: 日志模块

import sys
import logging
from logging.handlers import TimedRotatingFileHandler

log = logging.getLogger()
log.setLevel(logging.DEBUG)
formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")

log_file_handler = TimedRotatingFileHandler(filename="logs/log", when="D", interval=1, backupCount=4)

log_file_handler.setFormatter(formatter)
log_file_handler.setLevel(logging.DEBUG)
log.addHandler(log_file_handler)

stream_handler = logging.StreamHandler(sys.stdout)
stream_handler.setFormatter(formatter)
log.addHandler(stream_handler)
